<?php

class person {

public $id;
public $name;
public $mail;
public $phone;
public $national;
public $country;
public $city;
public $personalnumber;
public $mankind;
public $faculty;
public $level;
public $appreciation;
public $fathername;
public $fatherpersonalnumber;
public $sponsername;
public $sponserpersonalnumber;
public $sponserjob;
public $date; //when the user submit.
public $password;
    public function login($nationalid,$student_password){
        $sql=" select * from accounts where national_id='$nationalid' and student_pass='$student_password' ";
 $query=mysql_query($sql); 
 $result=mysql_fetch_assoc($query);
      $id= $result['national_id'] ; 
      $Pass= $result['student_pass'] ;
     if($nationalid==$id&&$student_password==$Pass)
         return 1;
     else
         return 0;
          }
          public function GetName($id){
        $sql=" select student_name from accounts where national_id='$id'";
 $query=mysql_query($sql); 
 $row = mysql_fetch_array($query);
      return $row['student_name'];
          }
          
    public function Updatepass($national_number,$password){
      $query="Update accounts set student_pass='$password' where national_id='$national_number'";
         mysql_query($query)or die(mysql_error());  
          }
                    public function ShowAccepted($Build_ID){
              $sql=" select * from student where building_number='$Build_ID'";
              $query=mysql_query($sql); 
              return $query;
          }
           public function selectstudentinroom($roomid,$building_id){
              $sql="select * from student where room_id='$roomid' and building_number='$building_id'";
              $query=mysql_query($sql); 
              return $query;
          }
          public function buildingnum($st_id){
              $sql="select * from student where  student_personalnumber='$st_id'";
              $query=mysql_query($sql);
              $row=mysql_fetch_array($query);
              return $row['building_number'];

              }
              
                 public function numberOfBuilding(){
         $sql="SELECT building_id FROM building";
       $query=mysql_query($sql)or die(mysql_error());
      $num_ros=mysql_num_rows($query);
      return $num_ros;
    }
}
?>
